/*!
// Testweb v0.4.0
// http://or-change.cn
// Copyright 2014 OrChange Inc. All rights reserved.
// Licensed under the GPL License.
*/
/*jslint vars: true, forin: true, plusplus: true */
/*global define: false */
/**
 * 运行结果对象，主要负责收集结果，转换成需要的格式
 * @module Result
 * @requires Entity
 * @example
 *     var Dict = require("./oc.dict"); //How to require Dict module.
 */
define(function (require, exports, module) {
	'use strict';
	var Entity = require("./entity");
	var Result;

	Result = function Result(options) {
		this.CURRENT = null;
		this.collection = [];
		this.$initialize(options);

		Entity.call(this, options);
	};
	Result.prototype = new Entity();
	Result.prototype.constructor = Result;

	Result.prototype.$initialize = function (options) {
		var i, head = [];
		for (i = 1; i <= options.length; i++) {
			head.push("# " + i);
		}
		this.collection.push(head);
		this.CURRENT = this.collection[this.collection.push([]) - 1];

		return this;
	};

	Result.prototype.addRow = function () {
		this.CURRENT = this.collection[this.collection.push([]) - 1];

		return this;
	};

	Result.prototype.addResult = function (result) {
		this.CURRENT.push(result);

		return this;
	};

	return Result;
});
